#include "../../common/asr.hpp"
#include <gflags/gflags.h>

DEFINE_string(app_id, "118938304", "百度语音识别的app_id");
DEFINE_string(api_key, "ijUAKZs6E0Ej0zhK7WIfCvq3", "百度语音识别的api_key");
DEFINE_string(secret_key, "6AcT8xdudZ57Ds9Caa52mqdKOCsy1NHt", "百度语音识别的secret_key");

DEFINE_bool(run_mode, false, "程序的运行模式, false-调试模式, true-发布模式");
DEFINE_string(log_file, "", "发布模式下, 用于指定日志文件的路径");
DEFINE_int32(log_level, 0, "发布模式下, 用于指定日志的输出等级");

int main(int argc, char* argv[])
{
    google::ParseCommandLineFlags(&argc, &argv, true);
    Init_logger(FLAGS_run_mode, FLAGS_log_file, FLAGS_log_level);

    ASRClient client(FLAGS_app_id, FLAGS_api_key, FLAGS_secret_key);

    std::string file_content;
    aip::get_file_content("16k.pcm", &file_content);

    std::string result = client.recognize(file_content);
    if(result.empty()) {
        return -1;
    }
    std::cout << result << std::endl;

    return 0;
}